home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiniExamples / AppKit / NormalBrowser / Controller.m < prev    next >
Text File  |  1995-06-12  |  948b  |  44 lines

  1. /* Controller.m
  2. *  Purpose: How to implement a normal browser.
  3. *
  4. *  You may freely copy, distribute, and reuse the code in this example.
  5. *  NeXT disclaims any warranty of any kind, expressed or  implied, as to its fitness
  6. *  for any particular use.
  7. *
  8. */
  9.  
  10.  
  11. #import "Controller.h"
  12.  
  13. @implementation Controller
  14.  
  15. - appDidInit:sender
  16. {
  17.     [myBrowser setDelegate:self];
  18.     [myBrowser loadColumnZero];
  19.     return self;
  20. }
  21.  
  22. - (int)browser:sender fillMatrix:matrix inColumn:(int)column
  23. {
  24.     char    buf[255];
  25.     int    row;
  26.     id    cell;
  27.     
  28.     for (row = 0; row < NUMROWS; row++)
  29.     {
  30.         sprintf(buf,"Column %d    Row %d", column, row);
  31.         [matrix addRow];
  32.         cell = [matrix cellAt: row  :0];    
  33.         /* Each column of the browser contains a separate */
  34.         /* matrix. So for each column in the browser we want */
  35.         /* to insert into column 0 for that matrix */  
  36.         [cell setStringValue:buf];
  37.         [cell setLoaded:YES];
  38.         [cell setLeaf:column < NUMCOLUMNS-1? NO : YES];
  39.     }
  40.     return NUMROWS;
  41. }
  42.  
  43. @end
  44.